#include "chemnitz.h"
#include "polarssl/aes.h"

static char version [128];
static char *vers = "libchemnitz version 0";

static char *impl = "AES-128";
void chemnitz_encrypt (const uint8_t *plaintextblock, const uint8_t *key, const uint8_t *ciphertextblock)
{
	aes_context ctx;

	memset ((void *) ciphertextblock, 0, 16);
	aes_init (&ctx);
	(void) aes_setkey_enc (&ctx, key, 128);
	(void) aes_crypt_ecb (&ctx, AES_ENCRYPT, plaintextblock, (unsigned char *) ciphertextblock);
	aes_free (&ctx);
}

void chemnitz_version (char **buffer)
{
	(void) snprintf (version, 128, "%s+%s", vers, impl);
	*buffer = version;
}

